package Compation;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class minSubsequence {
    public List<Integer> minSubsequence(int[] nums) {
        List<Integer> res = new ArrayList<>();
        Arrays.sort(nums);
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum += nums[i];
        }
        int subSum = 0;
        for (int j = nums.length - 1; j >= 0; j--) {
            subSum += nums[j];
            if (subSum <= sum - subSum) {
                res.add(nums[j]);
            } else {
                res.add(nums[j]);
                break;
            }
        }
        return res;
    }
}
